package edu.cmu.ece.ds.droidchat.retransmission;

import edu.cmu.ece.ds.droidchat.message.ChatSessionMessage;
import edu.cmu.ece.ds.droidchat.util.Toolbox;

public class ChatSendRecord {
	private ChatSessionMessage message;
	
	// the last time the message was sent
	private long timeSent;
	
	private String recipientUsername;
	private String destinationIP;

	private int sendCount = 0;
	
	public ChatSendRecord(ChatSessionMessage m, 
			long t,
			String ip,
			String recipient){
		message = m;
		timeSent = t;
		destinationIP = ip;
		recipientUsername = recipient;
	}
	
	public long getTimeSent() {
		return timeSent;
	}
	public void setTimeSent(long timeSent) {
		this.timeSent = timeSent;
	}
	public ChatSessionMessage getMessage() {
		return message;
	}
	public String chatSessionID(){
		return message.getChatSessionID();
	}
	public String getDestinationIP() {
		return destinationIP;
	}
	public String getRecipientUsername(){
		return recipientUsername;
	}
	public void resetSendCount(){
		sendCount = 0;
	}
	public void incrementSendCount(){
		sendCount++;
	}
	public int getSendCount(){
		return sendCount;
	}
	public void setIP(int i) {
		String ip = Toolbox.intToIp(i);
		if(!this.destinationIP.equals(ip))
			this.destinationIP = ip;
	}
}
